package sessionBeans;

import java.util.List;

import javax.ejb.Local;
import javax.ejb.Stateful;

import saa.model.Aluno;
import dao.AlunoDao;

@Stateful
@Local
public class Auth {
	
		private String session;
		private String password;
		
		public Auth() {
			super();
		}
		
		public boolean authenticate(String session , String password) {
			AlunoDao dao = new AlunoDao();
			List<Aluno> alunos = dao.getAlunos();
			for (Aluno aluno : alunos) {
				if(aluno.getNome().contentEquals(session))
				{
					if(aluno.getPassword().contentEquals(password)){
						return true;
					}
				}
			}
			return false;
		}
	
}
